﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Plexi.Configuration
{
	/// <summary>Stores data loaded from the configuration file. Is initialized via the ConfigLoader.</summary>
	public static class Config
	{
		private static bool _isInitialized = false;
		public static bool IsInitialized
		{
			get { return Config._isInitialized; }
			set { Config._isInitialized = value; }
		}
		private static Area _fa;
		private static double _lon;

		public static List<int> ForbiddenBodyIndices { get; set; }
		public static PolarCircles PolarCircles { get; set; }
		public static List<Area> ForbiddenAreas { get; set; }

		public static bool IsInForbiddenArea(RockInfo ri, CelestialBody body)
		{
			_lon = MathTools.NormalizeLongitude(ri.Lon);
			for (int i = 0; i < ForbiddenAreas.Count; i++)
			{
				_fa = ForbiddenAreas[i];
				if (_fa.Contains(body.flightGlobalsIndex, ri.Lat, _lon))
					return true;
			}
			return false;
		}
	}
}
